import React from 'react';
import Suit from './Suit' //引入定义好的高阶组件
class Kai extends React.Component{
    state={
        name:'李白',
        age:20,
        nickname:'诗仙',
        hobby:'吟诗'
    }
    render(){
        console.log(this.props); //打印的是从高阶组件中传递过来的数据
        let {nickname,weapon,skill,attack} = this.props 
        return(
            <fieldset>
                <legend>李白</legend>
                <h3>姓名：{this.state.name}</h3>
                <h3>昵称：{this.state.nickname}</h3>
                <h3>年龄：{this.state.age}</h3>
                <h3>爱好：{this.state.hobby}</h3>
                <h3>技能：{skill?skill:'写诗'}</h3>
                <h3>武器：{weapon?weapon:'111111111111'}</h3>
                <button onClick={()=>{
                    if(attack){
                        attack()
                    }else{
                        alert('你个龟孙，打死你。。。。')
                    }
                }}>点击攻击</button>
            </fieldset>
        )
    }
}
export default Suit(Kai)
